package com.Test1.Test2;

public abstract class pet {
    /*** 宠物吃食物。
     * * @param food
     * */

    public abstract void eat(Food food); // 运行的时候才知道动物吃啥食物
    public abstract void yelp(); // 叫
}

class Cat extends pet {
    public void huntMice(){
        System.out.println("捉老鼠");
    }

    @Override
    public void eat(Food food) {
        System.out.println("猫吃：" + food.show());
    }

    @Override
    public void yelp() {
        System.out.println("喵喵喵");
    }
}

class Dog extends pet {
    public void guardEntrance(){
        System.out.println("看门");

}
    @Override
    public void eat(Food food) {
        System.out.println("狗吃：" + food.show());
    }

    @Override
    public void yelp() {
        System.out.println("汪汪汪");
    }
}